import axios from 'axios'
import qs from 'qs'
// 实例对象
let instance1 = axios.create({
    timeout: 6000,
    baseURL:"https://www.ahsj.link/nebula-api/",
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
  
  // 请求拦截器
  instance1.interceptors.request.use(
    config => {
      config.data = qs.stringify(config.data) // 转为formdata数据格式
      let token= localStorage.getItem("token")
      if(token){
          config.headers["x-auth-token"]=token
      }
      console.log("config",config);
      return config
    },
    error => Promise.error(error)
  )
  export default instance1